<%-- 
    Document   : AMain
    Created on : Feb 26, 2012, 9:55:48 PM
    Author     : Jaice
--%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.CallableStatement"%>
<%@page import="dbhandler.DBConnector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1" />
        <META Http-Equiv="Cache-Control" Content="no-cache"/>
        <META Http-Equiv="Cache-Control" Content="no-store"/>
        <META Http-Equiv="Pragma" Content="no-cache"/>
        <META Http-Equiv="Expires" Content="0"/>

        <%
            response.setHeader("Cache-Control", "no-cache, must-revalidate, no-store");
            response.setHeader("Pragma", "no-cache");
            response.setDateHeader("Expires", 0);

        %>

        <link rel="stylesheet" href="../css/style.css" type="text/css" id="" media="print, projection, screen" />
        <script type="text/javascript" src="../script/jquery-latest.js"></script>
        <script type="text/javascript" src="../script/jquery.tablesorter.js"></script>
        <script type="text/javascript" src="../script/jquery.tablesorter.pager.js"></script>

        <script type="text/javascript">
            $(document).ready(function() {
                // call the tablesorter plugin
                $("table").tablesorter({
                    // sort on the first column and third column, order asc
                    sortList: [[1,0]],
                    headers: {
                        // assign the secound column (we start counting zero)
                        0: {
                            // disable it by setting the property sorter to false
                            sorter: false
                        },
                        1: {
                            // disable it by setting the property sorter to false
                            sorter: false
                        },
                        2: {
                            // disable it by setting the property sorter to false
                            sorter: false
                        }
                        ,
                        3: {
                            // disable it by setting the property sorter to false
                            sorter: false
                        }
                        ,
                        4: {
                            // disable it by setting the property sorter to false
                            sorter: false
                        }
                    }
                    ,
                    widthFixed: true, widgets: ['zebra']
                })
                .tablesorterPager({container: $("#pager")});
                ;
            });


        </script>
    </head>
    <link rel="stylesheet" href="../style/style.css" type="text/css" id="" media="print, projection, screen" />
    <jsp:useBean id="SecprogScopeSession" class=
                 "servlets.SecprogScopeSession" scope="session" />
    <%
        if (!SecprogScopeSession.getIsLogin()) {
            response.sendRedirect("../index.jsp");
        } else if (SecprogScopeSession.getAccounttype() == 1) {
            response.sendRedirect("../customer/CMain.jsp");
        } else if (SecprogScopeSession.getAccounttype() == 10) {
            response.sendRedirect("../admin/AMain.jsp");
        } else if (SecprogScopeSession.getAccounttype() == 3 || SecprogScopeSession.getAccounttype() == 4 || SecprogScopeSession.getAccounttype() == 5 || SecprogScopeSession.getAccounttype() == 6) {
            response.sendRedirect("../product/PMain.jsp");
        }


    %>
    <body bgcolor="#FFFACD">

        <table width="94%" border="0" align="center">

            <tr >
                <td style="background-color:#FFA500; height:100px">

                </td>
            </tr>
            <tr style="background-color:#FFA500; height:30px" align="center">

                <td><a href="PCMain.jsp">Home</a><font color="#FFFFFF" face="Arial">|</font>
                    <a href=""> </a><font color="#FFFFFF" face="Arial">|</font>
                    <a href="ViewFinance.jsp">View Finance</a><font color="#FFFFFF" face="Arial">|</font>
                    <a href="PSettings.jsp">Settings</a><font color="#FFFFFF" face="Arial">|</font>
                    <a href="../logout/LogoutProcess.jsp">Logout</a>
                </td>

            </tr>
            <tr style="background-color:#FFA500; height:30px" align="center">

                <td><a50>Welcome Accounting <%= SecprogScopeSession.getFullName()%><font color="#FFFFFF" face="Arial">|</font>
                Finance since <%= SecprogScopeSession.getDatecreated()%><font color="#FFFFFF" face="Arial">|</font>
                Last Login is <%= SecprogScopeSession.getLastlogin()%></a50>
        </td>

    </tr>

    <tr>
        <td style="padding-top:5%; padding-left:10%; padding-right:10%; padding-bottom:5%; background-color:#EEEEEE;height:auto;width:920px;">
    <a1>Accounting Home</a1><br>



    <table  border="0" id="myTable" class="tablesorter" style="width: 100%;" align="center">
        <thead> 
            <tr> 
                <th>Num</th> 
                <th>Category</th>

                <th>Title</th>
                <th>type</th>
                <th>Total</th> 

            </tr> 
        </thead> 

        <tbody> 

            <%

                DBConnector dbConnectorchk = null;
                dbConnectorchk = new DBConnector("localhost", 3306, "selector", "53l3ct0r", "bookaholic");

                dbConnectorchk.connectToDB();
                CallableStatement callable = null;
                ResultSet result = null;
                String authCall = "{ call select_all_transaction() }";
                callable = dbConnectorchk.getConnection().prepareCall(authCall);
                result = callable.executeQuery();
                String a = "";
                float b = 0;
                int ctr = 1;


                while (result.next()) {
                    a = result.getString("price").replaceAll("[\\,\\$]", "");
                    b = Float.valueOf(a.trim()).floatValue();
                    b = b * result.getInt("quantity");
                    System.out.println(b);
                    
           

            %><tr><td><%=ctr%></td>
                <td><%=result.getString("category")%></td>
                <td><%=result.getString("title")%></td>
                <td><%=result.getString("type")%></td>
                <td><%=b%></td></tr>
                <%
                        ctr++;
                    }

                %>


        </tbody> 
    </table> 
    <div id="pager" class="pager" align="left" style=" height: auto; width: 95%;">
        <form>
            <img src="addons/pager/icons/first.png" class="first"/>
            <img src="addons/pager/icons/prev.png" class="prev"/>
            <input readonly="readonly" type="text" class="pagedisplay"/>
            <img src="addons/pager/icons/next.png" class="next"/>
            <img src="addons/pager/icons/last.png" class="last"/>
            <select class="pagesize">
                <option selected="selected"  value="10">10</option>

                <option value="20">20</option>
                <option value="30">30</option>
                <option  value="40">40</option>
            </select>
        </form>
    </div> 

    <br>
    <br>
    username is <%= SecprogScopeSession.getUserName()%>
    Session  is <%= SecprogScopeSession.getIsLogin()%>
    accounttype  is <%= SecprogScopeSession.getAccounttype()%>
    Session  is <%= SecprogScopeSession.getSessionid()%>

    </td>
    </tr>

    <tr>
        <td colspan="2" style="background-color:#FFA500;text-align:center;">
            Copyright © 2011</td>
    </tr>
</table>

</body>
</html> 